﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace DotNetUniLodz.Models
{
    public class ArticleModel : Article
    {
        static DotNetULEntities db = new DotNetULEntities();
        public ArticleModel() : base() { }

        [Required]
        [DisplayName("Tytuł")]
        [MaxLength(100)]
        public new string Article_title { get; set; }

        [Required]
        [DisplayName("Treść")]
        public new string Article_text { get; set; }

        /// <summary>
        /// Pobiera Article z EF, gdyż nasz ArticleModel przesłania klasę Article
        /// </summary>
        public Article Article
        {
            get
            {
                Article article = new Article()
                {
                    Article_id = this.Article_id,
                    Article_creationDate = this.Article_creationDate,
                    Article_img = this.Article_img,
                    Article_lastMod = this.Article_lastMod,
                    Article_text = this.Article_text,
                    Article_title = this.Article_title,
                    Article_isMainArticle = this.Article_isMainArticle,
                    User_author = this.User_author
                };
                return article;
            }
        }
    }
}